package cn;

import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import javax.naming.NamingException;
import javax.naming.Reference;

import com.sun.jndi.rmi.registry.ReferenceWrapper;


/**
 *
 * RMI 的服务端
 *
 * @author summit
 * @since 2021/12/13 13:20
 */
public class RegistryServer {

	public static void main(String[] args) throws RemoteException, NamingException, AlreadyBoundException {

		Registry registry = LocateRegistry.createRegistry(1091);
		Reference reference = new Reference("AttachTest", "AttachTest", "http://localhost:80");
		ReferenceWrapper wrapper = new ReferenceWrapper(reference);
		registry.bind("obj", wrapper);
		System.out.println("RegistryServer running...............");

	}
}
